﻿using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace BitcoinMarket
{
    public class CurrencyDetailViewModel : INotifyPropertyChanged
    {
        private string _currencyName;

        public CurrencyDetailViewModel()
        {
            this.Items = new ObservableCollection<CurrencyItemViewModel>();
        }

        /// <summary>
        /// A collection for ItemViewModel objects.
        /// </summary>
        public ObservableCollection<CurrencyItemViewModel> Items { get; private set; }

        /// <summary>
        /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
        /// </summary>
        /// <returns></returns>
        public string CurrencyName
        {
            get
            {
                return _currencyName;
            }
            set
            {
                if (value != _currencyName)
                {
                    _currencyName = value;
                    NotifyPropertyChanged("CurrencyName");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    /// <summary>
    /// Items in the market Listbox for selecting the markets to show in the chart
    /// </summary>
    public class MarketSelectorItem
    {
        public MarketSelectorItem(Color color, string name, int index)
        {
            this.Color = color.ToString();
            this.MarketName = name;
            this.Index = index;
        }

        public string Color { get; set; }

        public int Index { get; set; }

        public string MarketName { get; set; }

        public override string ToString()
        {
            return this.MarketName;
        }
    }
}